package com.smarth.zhizulian.http.observer.bad;

import android.content.Context;

import com.smarth.zhizulian.bean.Page;
import com.smarth.zhizulian.http.observer.inter.IRefreshObserver;
import com.smarth.zhizulian.utils.listhelper.impl.model.ListDataModel;
import com.smarth.zhizulian.utils.listhelper.inter.ResponseSender;

import java.util.List;

/**
 * Created by 18865 on 2018/1/16.
 */

public class BadListObserver<T extends Page> extends IRefreshObserver<T> {
    private ListDataModel mModel;
    public BadListObserver(Context context, ResponseSender responseSender, ListDataModel model) {
        super(context, responseSender);
        mModel = model;
    }

    @Override
    public void onNext(T t) {
        super.onNext(t);
        List list = t.getList();
        mResponseSender.sendData(list);
        mModel.mPage = t.getPageNo();
        mModel.mMaxPage = t.getPageNum();
    }
}
